package com.asyf.shoporder.controller;

import com.asyf.shopcommon.Product;
import com.asyf.shoporder.service.ProductService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * sentinel启动命令（单独的jar，目录：D:\jar\sentinel-dashboard-1.8.0.jar）
 * java -Dserver.port=8080 -Dnacos.serverAddr=localhost:8848 -Dcsp.sentinel.dashboard.server=localhost:8080 -Dproject.name=sentinel-dashboard -jar sentinel-dashboard-1.8.0.jar
 * http://localhost:8080
 */
@RestController
@Slf4j
public class OrderController3 {

    @Autowired
    private ProductService productService;

    //成功对的配置：service-order-sentinel
    //http://localhost:8092/order/message1
    @RequestMapping("/order/message1")
    public String message1() {
        log.info("message1");
        //feign支持链路追踪
        //通过fegin调用商品微服务
        Product product = productService.findByPid(1);
        return "message1";
    }

    @RequestMapping("/order/message2")
    public String message2() {
        return "message2";
    }

}
